package hu.home.arb.db;

import hu.home.arb.common.Constants;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class Db {
	public Connection conn = null;
	
	public Connection getConn() {
		return conn;
	}

	public void setConn(Connection conn) {
		this.conn = conn;
	}

	public Db() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
		super();
		Class.forName(Constants.DB_DRIVER).newInstance();
		conn = DriverManager.getConnection(Constants.DB_URL + Constants.DB_NAME, Constants.DB_USERNAME, Constants.DB_PASSWORD);
	}

	public void close() throws SQLException {
		conn.close();
	}
	
}
